Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror-graphql

Package Overview
Dependencies
Maintainers
1
Versions
258
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror-graphql

GraphQL mode and helpers for CodeMirror.

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
200K
decreased by-50.22%
Maintainers
1
Weekly downloads
 
Created

What is codemirror-graphql?

The codemirror-graphql npm package provides a set of tools and utilities to integrate GraphQL syntax highlighting, linting, and autocomplete features into CodeMirror, a versatile text editor implemented in JavaScript for the browser.

What are codemirror-graphql's main functionalities?

Syntax Highlighting

This feature allows you to enable GraphQL syntax highlighting in a CodeMirror editor instance. The code sample demonstrates how to set up a CodeMirror editor with GraphQL mode enabled.

import { GraphQLMode } from 'codemirror-graphql';
import CodeMirror from 'codemirror';

const editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
  mode: 'graphql',
  lineNumbers: true
});

Linting

This feature provides linting capabilities for GraphQL code within a CodeMirror editor. The code sample shows how to enable linting by setting the 'lint' option to true and adding the 'CodeMirror-lint-markers' gutter.

import { GraphQLLint } from 'codemirror-graphql';
import CodeMirror from 'codemirror';

const editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
  mode: 'graphql',
  lint: true,
  gutters: ['CodeMirror-lint-markers']
});

Autocomplete

This feature enables autocomplete functionality for GraphQL code in a CodeMirror editor. The code sample demonstrates how to set up the editor to trigger autocomplete suggestions with the 'Ctrl-Space' key combination.

import { GraphQLHints } from 'codemirror-graphql';
import CodeMirror from 'codemirror';

const editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
  mode: 'graphql',
  extraKeys: { 'Ctrl-Space': 'autocomplete' }
});

Other packages similar to codemirror-graphql

FAQs

Package last updated on 03 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc